/*   1:    */ package com.atomikos.icatch.imp;
/*   2:    */ 
/*   3:    */ import com.atomikos.icatch.RecoveryCoordinator;
/*   4:    */ import com.atomikos.icatch.TxState;
/*   5:    */ import com.atomikos.persistence.ObjectImage;
/*   6:    */ import com.atomikos.persistence.Recoverable;
/*   7:    */ import java.io.IOException;
/*   8:    */ import java.io.InvalidClassException;
/*   9:    */ import java.io.ObjectInput;
/*  10:    */ import java.io.ObjectOutput;
/*  11:    */ import java.util.Vector;
/*  12:    */ 
/*  13:    */ class CoordinatorLogImage
/*  14:    */   implements ObjectImage
/*  15:    */ {
/*  16:    */   static final long serialVersionUID = 3404629869531420208L;
/*  17:    */   String root_;
/*  18:    */   TxState state_;
/*  19:    */   boolean heuristicCommit_;
/*  20:    */   Vector participants_;
/*  21:    */   RecoveryCoordinator coordinator_;
/*  22:    */   long maxInquiries_;
/*  23:    */   CoordinatorStateHandler stateHandler_;
/*  24:    */   boolean activity_;
/*  25:    */   int localSiblingCount_;
/*  26:    */   boolean checkSiblings_;
/*  27:    */   boolean single_threaded_2pc_;
/*  28:    */   
/*  29:    */   public CoordinatorLogImage() {}
/*  30:    */   
/*  31:    */   public CoordinatorLogImage(String root, TxState state, Vector participants, RecoveryCoordinator coordinator, boolean commit_on_heuristic, long maxinquiries, CoordinatorStateHandler stateHandler, boolean single_threaded_2pc)
/*  32:    */   {
/*  33:106 */     this.root_ = root;
/*  34:107 */     this.state_ = state;
/*  35:108 */     this.participants_ = participants;
/*  36:109 */     this.coordinator_ = coordinator;
/*  37:110 */     this.heuristicCommit_ = commit_on_heuristic;
/*  38:111 */     this.maxInquiries_ = maxinquiries;
/*  39:112 */     this.stateHandler_ = stateHandler;
/*  40:113 */     this.activity_ = false;
/*  41:114 */     this.localSiblingCount_ = 0;
/*  42:115 */     this.checkSiblings_ = false;
/*  43:116 */     this.single_threaded_2pc_ = single_threaded_2pc;
/*  44:    */   }
/*  45:    */   
/*  46:    */   public CoordinatorLogImage(String root, TxState state, Vector participants, RecoveryCoordinator coordinator, boolean commit_on_heuristic, long maxinquiries, CoordinatorStateHandler stateHandler, int localSiblingCount, boolean checkSiblings, boolean single_threaded_2pc)
/*  47:    */   {
/*  48:141 */     this(root, state, participants, coordinator, commit_on_heuristic, maxinquiries, stateHandler, single_threaded_2pc);
/*  49:    */     
/*  50:143 */     this.activity_ = true;
/*  51:144 */     this.localSiblingCount_ = localSiblingCount;
/*  52:145 */     this.checkSiblings_ = checkSiblings;
/*  53:    */   }
/*  54:    */   
/*  55:    */   public Object getId()
/*  56:    */   {
/*  57:150 */     return this.root_;
/*  58:    */   }
/*  59:    */   
/*  60:    */   public void writeExternal(ObjectOutput out)
/*  61:    */     throws IOException
/*  62:    */   {
/*  63:158 */     out.writeObject(this.root_);
/*  64:159 */     out.writeObject(this.state_);
/*  65:160 */     out.writeObject(this.participants_.clone());
/*  66:161 */     if (this.coordinator_ == null)
/*  67:    */     {
/*  68:162 */       out.writeBoolean(false);
/*  69:    */     }
/*  70:    */     else
/*  71:    */     {
/*  72:164 */       out.writeBoolean(true);
/*  73:165 */       out.writeObject(this.coordinator_);
/*  74:    */     }
/*  75:167 */     out.writeBoolean(this.heuristicCommit_);
/*  76:168 */     out.writeLong(this.maxInquiries_);
/*  77:169 */     out.writeObject(this.stateHandler_.clone());
/*  78:170 */     out.writeBoolean(this.activity_);
/*  79:171 */     if (this.activity_)
/*  80:    */     {
/*  81:172 */       out.writeInt(this.localSiblingCount_);
/*  82:173 */       out.writeBoolean(this.checkSiblings_);
/*  83:    */     }
/*  84:175 */     out.writeBoolean(this.single_threaded_2pc_);
/*  85:    */   }
/*  86:    */   
/*  87:    */   public void readExternal(ObjectInput in)
/*  88:    */     throws IOException, ClassNotFoundException
/*  89:    */   {
/*  90:    */     try
/*  91:    */     {
/*  92:183 */       this.root_ = ((String)in.readObject());
/*  93:184 */       this.state_ = ((TxState)in.readObject());
/*  94:185 */       this.participants_ = ((Vector)in.readObject());
/*  95:186 */       boolean readcoord = in.readBoolean();
/*  96:187 */       if (readcoord) {
/*  97:188 */         this.coordinator_ = ((RecoveryCoordinator)in.readObject());
/*  98:    */       }
/*  99:189 */       this.heuristicCommit_ = in.readBoolean();
/* 100:190 */       this.maxInquiries_ = in.readLong();
/* 101:191 */       this.stateHandler_ = ((CoordinatorStateHandler)in.readObject());
/* 102:192 */       this.activity_ = in.readBoolean();
/* 103:193 */       if (this.activity_)
/* 104:    */       {
/* 105:194 */         this.localSiblingCount_ = in.readInt();
/* 106:195 */         this.checkSiblings_ = in.readBoolean();
/* 107:    */       }
/* 108:197 */       this.single_threaded_2pc_ = in.readBoolean();
/* 109:    */     }
/* 110:    */     catch (InvalidClassException ex)
/* 111:    */     {
/* 112:200 */       throw ((IOException)new IOException("Object of class " + ex.classname + " in transaction log" + " not compatible with version found in classpath").initCause(ex));
/* 113:    */     }
/* 114:    */   }
/* 115:    */   
/* 116:    */   public Recoverable restore()
/* 117:    */   {
/* 118:207 */     CoordinatorImp coord = new CoordinatorImp();
/* 119:    */     
/* 120:209 */     coord.restore(this);
/* 121:    */     
/* 122:211 */     return coord;
/* 123:    */   }
/* 124:    */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.CoordinatorLogImage
 * JD-Core Version:    0.7.0.1
 */